package cn.tyf.dao;

import cn.tyf.domain.WxFun;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface WxFunDao {

    /**
     * 查询所有
     * @return
     */
    @Select("select * from wxfun order by fid asc")
    List<WxFun> wxFunList();

    /**
     * 添加数据
     * @param wxFun
     */
    @Insert("insert into wxfun(fid,img,drive,description,flag1) value(#{fid},#{img},#{drive},#{description},#{flag1})")
    void addFun(WxFun wxFun);

    /**
     * 查詢总记录数
     * @return
     */
    @Select("select count(*) from wxfun")
    int count();

    /**
     * 分页查询
     * @param start
     * @param pageSize
     * @return
     */
    @Select("select * from wxfun limit #{arg0},#{arg1}")
    List<WxFun> findWxFunPage(Integer start,Integer pageSize);

    /**
     * 根据设备编号查询
     * @param fid
     * @return
     */
    @Select("select * from wxfun where fid = #{fid}")
    WxFun findByFid(Integer fid);

    @Delete("delete from wxfun where id = #{id}")
    void delWxfun(Integer id);

    int updateWxFun(WxFun wxFun);

    int delWxFunByIds(List list);
}
